<?php
/**
 * RedCross_Gateway_Base_ShiftExchange
 *
 * @property integer $id
 * @property integer $shift_role_id
 * @property integer $member_id
 * @property boolean $is_accepted
 * @property timestamp $request_sent_time
 * @property timestamp $request_handled_time
 * @property RedCross_Gateway_Base_ShiftRole $ShiftRole
 * @property RedCross_Gateway_Base_Member $SourceMember
 * @property RedCross_Gateway_Base_Member $TargetMember
 *
 * @package     ##PACKAGE##
 * @subpackage  ##SUBPACKAGE##
 * @author      ##NAME## <##EMAIL##>
 * @version     1
 */

class RedCross_Gateway_Base_ShiftExchange extends Doctrine_Record
{
    public function setTableDefinition()
    {
        $this->setTableName('shift_exchange');
        $this->hasColumn('id', 'integer', 4, array(
            'type' => 'integer',
            'primary' => true,
            'autoincrement' => true,
            'length' => 4,
        ));
        $this->hasColumn('shift_role_id', 'integer', 4, array(
            'type' => 'integer',
            'notnull' => true,
            'length' => 4,
        ));
        $this->hasColumn('source_member_id', 'integer', 4, array(
            'type' => 'integer',
            'notnull' => true,
            'length' => 4,
        ));
        $this->hasColumn('target_member_id', 'integer', 4, array(
            'type' => 'integer',
            'notnull' => true,
            'length' => 4,
        ));
        $this->hasColumn('is_accepted', 'boolean', null, array(
            'type' => 'boolean',
        ));
        $this->hasColumn('request_sent_time', 'timestamp', null, array(
            'type' => 'timestamp',
        ));
        $this->hasColumn('request_handled_time', 'timestamp', null, array(
            'type' => 'timestamp',
        ));
    }

    public function setUp()
    {
        parent::setUp();
        $this->hasOne('RedCross_Gateway_Base_ShiftRole as ShiftRole', array(
            'local' => 'shift_role_id',
            'foreign' => 'id'
        ));
        $this->hasOne('RedCross_Gateway_Base_Member as SourceMember', array(
            'local' => 'source_member_id',
            'foreign' => 'id'
        ));
        $this->hasOne('RedCross_Gateway_Base_Member as TargetMember', array(
            'local' => 'target_member_id',
            'foreign' => 'id'
        ));
        $timestampable0 = new Doctrine_Template_Timestampable(array(
            'created' => array(
                'name' => 'request_sent_time',
                'type' => 'timestamp',
                'format' => 'Y-m-d H:i:s',
            ),
            'updated' => array('disabled' => true)
        ));
        $this->actAs($timestampable0);
    }
}

?>
